<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateTransactionsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('transactions', function (Blueprint $table) {
            $table->id();
            $table->bigInteger('user_id')->index()->comment('用户ID');
            $table->bigInteger('user_withdraw_id')->index()->comment('提现申请ID');
            $table->string('transaction_no')->index()->comment('交易号');
            $table->decimal('trans_amount')->default(0)->comment('转账金额');
            $table->string('account_type')->default('')->comment('账号类型');
            $table->string('account_no')->default('')->comment('对方账号');
            $table->string('remote_order_no')->index()->comment('订单号');
            $table->string('bankinfo')->default('')->comment('转账账号类型');
            $table->char('status')->default(\App\Constant\Enum::TRANSACTION_STATUS_PENDING)->comment('状态');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('transactions');
    }
}
